Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Speculative validation optimizations #9593

Merged
merged 4 commits into from
Oct 28, 2020
Merged

Speculative validation optimizations #9593

merged 4 commits into from
Oct 28, 2020

Conversation

heifner
Copy link
Contributor

@heifner heifner commented Oct 22, 2020

Change Description

  • unapplied_transaction_queue used to have a process_mode where it would not store aborted or forked-out transactions when in knew that the node would never produce a block. This was an optimization because there seemed to be no reason to cache aborted or forked-out transactions. Since the trx has been validated locally and will not be validated again, why keep it around? If you are producing you need to keep it so on a fork-switch the trxs are not lost. But there seemed to be no reason to keep them for speculative mode. However, the unapplied_transaction_queue is also used when validating a block to look up already validated and constructed transaction_metadata. Keeping the already validated trxs in the queue allows for faster validation of received blocks for all the transactions already received by the node.
  • Before this change, when a speculative node's speculative block ran out of cpu or net, it would stop validating transactions until it received a block -- which would cause it to start a new speculative block after processing the received block. With this PR, a new speculative block is created anytime a block is exhausted during speculative transaction processing.
  • Before this change speculative 12th blocks would use the last-block-time-offset-us which doesn't really make any sense since the block is only speculative and will not be broadcast on the network. With this PR, all speculative blocks use the produce-time-offset-us including the 12th block.

Change Type

Select ONE

  • Documentation
  • Stability bug fix
  • Other
  • Other - special case

Consensus Changes

  • Consensus Changes

API Changes

  • API Changes

Documentation Additions

  • Documentation Additions

@heifner heifner requested a review from b1bart October 22, 2020 20:32
@heifner
Copy link
Contributor Author

heifner commented Oct 22, 2020

PR reviewer: Verify that run-away memory is not an issue with possibility of trxs making it into the unapplied_transaction_queue but never being cleared. I don't think this is an issue, but something to consider.

@b1bart b1bart merged commit b47194a into develop Oct 28, 2020
@b1bart b1bart deleted the spike-kevinh branch October 28, 2020 14:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants